// 澶嶆潅鐨勮嚜瀹氫箟瑕嗙洊鐗?
function ComplexCustomOverlay(point, text, mouseoverText, btnType, reactFunc){
  this._point = point;
  this._text = text;
  this._overText = mouseoverText;
  this._click = reactFunc;
  this._btnType = btnType;
}
ComplexCustomOverlay.prototype = new BMap.Overlay();
ComplexCustomOverlay.prototype.initialize = function(map){
  this._map = map;
  var div = this._div = document.createElement("div");
  if(this._btnType == "cancle"){
	  div.style.position = "absolute";
	  div.style.zIndex = BMap.Overlay.getZIndex(this._point.lat);
	  div.style.backgroundColor = "#b1b1b1";
	  div.style.border = "1px solid #32B5CB";
	  div.style.color = "white";
	  div.style.height = "26px";
	  div.style.padding = "0px 18px";
	  div.style.lineHeight = "26px";
	  div.style.whiteSpace = "nowrap";
	  div.style.MozUserSelect = "none";
	  div.style.fontSize = "12px"
	  div.style.cursor = "pointer";
  }else if(this._btnType == "submit"){
	  div.style.position = "absolute";
	  div.style.zIndex = BMap.Overlay.getZIndex(this._point.lat);
	  div.style.backgroundColor = "#32b5cb";
	  div.style.border = "1px solid #32B5CB";
	  div.style.color = "white";
	  div.style.height = "26px";
	  div.style.padding = "0px 18px";
	  div.style.lineHeight = "26px";
	  div.style.whiteSpace = "nowrap";
	  div.style.MozUserSelect = "none";
	  div.style.fontSize = "12px"
	  div.style.cursor = "pointer";
  }else if(this._btnType == "showSitesCircle"){
	  //这里去设置div的高度、宽度、背景即可
	  // arrow.style.background = "url(http://map.baidu.com/fwmap/upload/r/map/fwmap/static/house/images/label.png) no-repeat";
	  div.style.position = "absolute";
	  div.style.zIndex = BMap.Overlay.getZIndex(this._point.lat);
	  //div.style.backgroundColor = "#32b5cb";
	  div.style.background = "url(/dtkl/assets/css/images/siteCircleShow.png) no-repeat";
	  //div.style.border = "1px solid #32B5CB";
	  //div.style.color = "white";
	  div.style.width = "50px";
	  div.style.height = "50px";
	  //div.style.padding = "0px 18px";
	  //div.style.lineHeight = "26px";
	  div.style.whiteSpace = "nowrap";
	  div.style.MozUserSelect = "none";
	  //div.style.fontSize = "12px"
	  div.style.cursor = "pointer";
	  div.title = "隐藏基站信号范围";
  }else if(this._btnType == "hideSitesCircle"){
	  div.style.position = "absolute";
	  div.style.zIndex = BMap.Overlay.getZIndex(this._point.lat);
	  //div.style.backgroundColor = "#b1b1b1";
	  div.style.background = "url(/dtkl/assets/css/images/siteCircleHide.png) no-repeat";
	  //div.style.border = "1px solid #32B5CB";
	  //div.style.color = "white";
	  div.style.width = "50px";
	  div.style.height = "50px";
	  //div.style.padding = "0px 18px";
	  //div.style.lineHeight = "26px";
	  div.style.whiteSpace = "nowrap";
	  div.style.MozUserSelect = "none";
	  //div.style.fontSize = "12px"
	  div.style.cursor = "pointer";
	  div.title = "显示基站信号范围";
  }
  
  var span = this._span = document.createElement("span");
  div.appendChild(span);
  //span.appendChild("<spa>X</span>");
  span.appendChild(document.createTextNode(this._text));      
  var that = this;
  
  div.onclick = this._click;
  
  //濡傛灉鏈夐棶棰橈紝妫?煡杩欓噷鐨刴ap鍙橀噺锛岀櫨搴emo涓澶勫彇寰楁槸mp鍏ㄥ眬鍙橀噺锛岃?涓嶆槸鏂规硶鍐呯殑map锛屼絾鐜板湪鍔熻兘鑳藉疄鐜帮紝鍏堣繖鏍?
  map.getPanes().labelPane.appendChild(div);
  
  return div;
}
ComplexCustomOverlay.prototype.draw = function(){
  var map = this._map;
  var pixel = map.pointToOverlayPixel(this._point);
  //璁剧疆
  if(this._btnType == "cancle"){
	  this._div.style.left = pixel.x - 120 + "px";
  }else if(this._btnType == "submit"){
	  this._div.style.left = pixel.x - 60 + "px";
  }else if(this._btnType == "showSitesCircle"){
	  this._div.style.left = pixel.x + 8 + "px";
  }else if(this._btnType == "hideSitesCircle"){
	  this._div.style.left = pixel.x + 8 + "px";
  }
  this._div.style.top  = pixel.y + 1 + "px";
}
ComplexCustomOverlay.prototype.getPosition = function(){
	return this._point;
}